home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter / MeshWriterTest / modules / cube.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  3.6 KB  |  115 lines

  1. /*
  2. **      $VER: cube.c 1.00 (27.3.1999)
  3. **
  4. **      Creation date     : 20.3.1999
  5. **
  6. **      Description       :
  7. **         MeshWriter testprogram shape module.
  8. **
  9. **
  10. **      Written by Stephan Bielmann
  11. **
  12. */
  13.  
  14. /*************************** Includes *******************************/
  15.  
  16. #ifndef WITHMWLLIB
  17. #include "//meshlib.h"
  18. #else
  19. #include <meshwriter/meshwriter.h>
  20. #include <pragma/meshwriter_lib.h>
  21. #endif
  22.  
  23. /**************************** Defines *******************************/
  24.  
  25. /*********************** Type definitions ***************************/
  26.  
  27. /********************** Private functions ***************************/
  28.  
  29. /********************** Public functions ****************************/
  30.  
  31. /********************************************************************\
  32. *                                                                    *
  33. * Name         : cube                                                *
  34. *                                                                    *
  35. * Description  : Draws a multicolored pyramid mesh. By setting all   *
  36. *                vertice values direct as fixed values.              *
  37. *                                                                    *
  38. * Arguments    : mesh    IN  : An initialized mesh handle.           *
  39. *                                                                    *
  40. * Comment      :                                                     *
  41. *                                                                    *
  42. \********************************************************************/
  43. void cube (ULONG mesh) {
  44.  ULONG mat1,mat2,mat3;
  45.  TOCLColor color;
  46.  TOCLVertex v1,v2,v3,v4,v5,v6,v7,v8;
  47.  
  48.  v1.x=-10,v1.y=-10,v1.z=-10;
  49.  v2.x=10,v2.y=-10,v2.z=-10;
  50.  v3.x=10,v3.y=10,v3.z=-10;
  51.  v4.x=-10,v4.y=10,v4.z=-10;
  52.  v5.x=-10,v5.y=-10,v5.z=10;
  53.  v6.x=10,v6.y=-10,v6.z=10;
  54.  v7.x=10,v7.y=10,v7.z=10;
  55.  v8.x=-10,v8.y=10,v8.z=10;
  56.  
  57.  MWLMeshMaterialAdd(mesh,&mat1);
  58.  color.r=0,color.g=0,color.b=255;
  59.  MWLMeshMaterialDiffuseColorSet(mesh,mat1,&color);
  60.  MWLMeshMaterialShininessSet(mesh,mat1,1);
  61.  MWLMeshMaterialTransparencySet(mesh,mat1,0);
  62.  
  63.  MWLMeshMaterialAdd(mesh,&mat2);
  64.  color.r=0,color.g=255,color.b=0;
  65.  MWLMeshMaterialDiffuseColorSet(mesh,mat2,&color);
  66.  MWLMeshMaterialShininessSet(mesh,mat2,1);
  67.  MWLMeshMaterialTransparencySet(mesh,mat2,0);
  68.  
  69.  MWLMeshMaterialAdd(mesh,&mat3);
  70.  color.r=255,color.g=0,color.b=0;
  71.  MWLMeshMaterialDiffuseColorSet(mesh,mat3,&color);
  72.  MWLMeshMaterialShininessSet(mesh,mat3,1);
  73.  MWLMeshMaterialTransparencySet(mesh,mat3,0);
  74.  
  75.  MWLMeshNameSet(mesh,"Cube");
  76.  
  77.  MWLMeshPolygonAdd(mesh,mat1);
  78.  MWLMeshPolygonVertexAdd(mesh,&v1);
  79.  MWLMeshPolygonVertexAdd(mesh,&v2);
  80.  MWLMeshPolygonVertexAdd(mesh,&v6);
  81.  MWLMeshPolygonVertexAdd(mesh,&v5);
  82.  
  83.  MWLMeshPolygonAdd(mesh,mat1);        
  84.  MWLMeshPolygonVertexAdd(mesh,&v8);
  85.  MWLMeshPolygonVertexAdd(mesh,&v7);
  86.  MWLMeshPolygonVertexAdd(mesh,&v3);
  87.  MWLMeshPolygonVertexAdd(mesh,&v4);
  88.  
  89.  MWLMeshPolygonAdd(mesh,mat2);        
  90.  MWLMeshPolygonVertexAdd(mesh,&v5);
  91.  MWLMeshPolygonVertexAdd(mesh,&v6);
  92.  MWLMeshPolygonVertexAdd(mesh,&v7);
  93.  MWLMeshPolygonVertexAdd(mesh,&v8);
  94.  
  95.  MWLMeshPolygonAdd(mesh,mat2);        
  96.  MWLMeshPolygonVertexAdd(mesh,&v4);
  97.  MWLMeshPolygonVertexAdd(mesh,&v3);
  98.  MWLMeshPolygonVertexAdd(mesh,&v2);
  99.  MWLMeshPolygonVertexAdd(mesh,&v1);
  100.  
  101.  MWLMeshPolygonAdd(mesh,mat3);
  102.  MWLMeshPolygonVertexAdd(mesh,&v4);
  103.  MWLMeshPolygonVertexAdd(mesh,&v1);
  104.  MWLMeshPolygonVertexAdd(mesh,&v5);
  105.  MWLMeshPolygonVertexAdd(mesh,&v8);
  106.  
  107.  MWLMeshPolygonAdd(mesh,mat3);
  108.  MWLMeshPolygonVertexAdd(mesh,&v2);
  109.  MWLMeshPolygonVertexAdd(mesh,&v3);
  110.  MWLMeshPolygonVertexAdd(mesh,&v7);
  111.  MWLMeshPolygonVertexAdd(mesh,&v6);
  112. }
  113.  
  114. /************************* End of file ******************************/
  115.